#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 4e5 + 10, INF = 0x3f3f3f3f;

int n, m, q;
set<int> r[N], c[N];

pair<int, int> find(set<int>& s, int k)
{
    if (s.size() == 0) return { -1,-1 };
    set<int>::iterator l, r;
    r = l = s.lower_bound(k); l--;
    if (r == s.begin()) return { -1,*r };
    if (r == s.end()) return { *l,-1 };
    return { *l,*r };
}

void solve()
{
    cin >> n >> m >> q;
    for (int i = 1;i <= n;i++)
        for (int j = 1;j <= m;j++)
            r[i].insert(j), c[j].insert(i);

    while (q--) {
        int x, y;cin >> x >> y;
        if (r[x].count(y)) {//这个位置还存在墙面
            r[x].erase(y);
            c[y].erase(x);
        } else {//不存在墙面
            auto [L, R] = find(r[x], y);
            if (L != -1) {
                r[x].erase(L);
                c[L].erase(x);
            }
            if (R != -1) {
                r[x].erase(R);
                c[R].erase(x);
            }
            auto [U, D] = find(c[y], x);
            if (U != -1) {
                c[y].erase(U);
                r[U].erase(y);
            }
            if (D != -1) {
                c[y].erase(D);
                r[D].erase(y);
            }
            // cout << L << ' ' << R << ' ' << U << ' ' << D << '\n';
        }
    }
    int ans = 0;
    for (int i = 1;i <= n;i++) ans += r[i].size();
    cout << ans << '\n';
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}